export const formatTime = (date: Date) => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return (
    [year, month, day].map(formatNumber).join('/') +
    ' ' +
    [hour, minute, second].map(formatNumber).join(':')
  )
}

const formatNumber = (n: number) => {
  const s = n.toString()
  return s[1] ? s : '0' + s
}
/**
 * rpx转px
 * @param rpx rpx值
 * @returns px值
 */
export function rpx2px(rpx:number){
	return ( wx.getSystemInfoSync().windowWidth / 750) * rpx
}
/**
 * px转rpx
 * @param px px值
 * @returns rpx值
 */
export function px2rpx(px:number){
	return px * ( 750 / wx.getSystemInfoSync().windowWidth)
}
